﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace YJKDimensionModel.SymbolTextSetting
{
	public class GridCollector : CollectorBase
	{
		public List<Grid> GridList { get; set; }

		public GridCollector(Autodesk.Revit.DB.Document doc)
		{
			this.GridList = new List<Grid>();
			base.Doc = doc;
		}

		public GridCollector()
		{
		}

		private bool GridListInit()
		{
			if (this.GridList.Count > 0)
			{
				this.GridList.Clear();
			}
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(base.Doc);
			ElementClassFilter elementClassFilter = new ElementClassFilter(typeof(Grid));
			IList<Element> list = filteredElementCollector.WherePasses(elementClassFilter).ToElements();
			foreach (Element element in list)
			{
				Grid grid = element as Grid;
				if (grid != null)
				{
					this.GridList.Add(grid);
				}
			}
			return true;
		}

		public override bool CollectorInit()
		{
			this.GridList.Clear();
			return this.GridListInit();
		}

		private const string GRID_GUID = "4F9061E6-11F5-4FA4-B5F6-B1913E18A434";
	}
}
